<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
	protected function _initDb()
	{
		$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/application.ini',
			'develop',
			array('driver_options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'))
		);
		//@todo разобратся с кодировками в базе
		
		$db = Zend_Db::factory($config->resources->db);
        Zend_Db_Table_Abstract::setDefaultAdapter($db);
        Zend_Registry::set('db' , $db);
	}
	
    protected function _initAutoload()
    {
        $autoloader = new Zend_Application_Module_Autoloader(
        array(
            'namespace' => '',
            'basePath'  => APPLICATION_PATH
        ));


        $autoloader->addResourceTypes(array(
	    'App' => array(
	        'path'      =>'/library/ZloY/',
	        'namespace' => 'ZloY_',
	    )));
        return $autoloader;
    }
   
    protected function _initView()
    {
    	$this->bootstrap('layout');
    	$layout = $this->getResource('layout');
    	$layout->setLayout('default');
    	$view = $layout->getView();
    	$view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8');
    	$view->headTitle('Zablife');
    	$view->headTitle()->setSeparator(' - ');
    }
} 